<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
	<title>12-分组别名</title>
	<style type="text/css">
	* {
		padding: 0;
		margin: 0;
	}
	span.red{
		color: red;
	}
    </style>
</head>
<body>
	<div class="container" id="container">
	 <a href="https://www.houdunren.com">后盾人</a>
  <a href="https://www.hdcms.com">hdcms</a>
  <a href='https://www.sina.com.cn'>新浪</a>
	</div>
	<script src="../tools/utils.js"></script>
	<script type="text/javascript">
	var html = container.innerHTML
	var html = `

	 <a href="https://www.houdunren.com">后盾人</a>
  <a href="https://www.hdcms.com'>hdcms</a>
  <a href='https://www.sina.com.cn'>新浪</a>

  `
	var reg = /<a.*href=(['"])(?<link>.*)\1.*>(?<title>.*)<\/a>/g
	var reg = /a.+?(?<link>https?:\/\/(\w+\.)+(com|cn|org|cc)).*>(?<title>.+)<\/a>/g
	console.log(html.match(reg))

	// console.log( reg.exec(html) )
	// console.log( reg.exec(html) )
	// console.log( reg.exec(html) )
	// console.log( reg.exec(html) )

	var match, list = []
	while(match = reg.exec(html)) {
		console.log(match.groups)
		list.push(match.groups)
	}
	console.log(JSON.stringify(list, null, 2))
	console.log('end.')
	

	</script>
</body>
</html>